package orderProcessingProcess.model;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dreni
 */
@XmlRootElement(name="customer")
public class Customer {

    private String id;
    private String name;
    private Address address;
    private Payment_Preference paymentPreference;

    // Empty Constructor
    public Customer(){
    }
    
    public Customer(String id, String name, Address address, Payment_Preference paymentPreference)
    {
    	this.id = id;
    	this.name = name;
    	this.address = address;
    	this.paymentPreference = paymentPreference;
    }

    /**
     * @return the id
     */

    @XmlAttribute(name="customer_id", required =true)
    public String getId() {
        return id;
    }

    /**
     * @param id the id to set
     */
    public void setId(String id) {
        this.id = id;
    }

    /**
     * @return the name
     */
    @XmlElement(name="customer_name", required =true)
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the address
     */
    @XmlElement(name="customer_address", required =true)
    public Address getAddress() {
        return address;
    }

    /**
     * @param address the address to set
     */
    public void setAddress(Address address) {
        this.address = address;
    }

    /**
     * @return the paymentPreference
     */
    @XmlElement(name="costumer_payment_preference", required =true)
    public Payment_Preference getPaymentPreference() {
        return paymentPreference;
    }

    /**
     * @param paymentPreference the paymentPreference to set
     */
    public void setPaymentPreference(Payment_Preference paymentPreference) {
        this.paymentPreference = paymentPreference;
    }
    
    @Override
    public boolean equals(Object obj) {
    	if(obj.getClass().equals(Customer.class))
    	{
    		if(this.id.equals(((Customer)obj).getId()))
    			return true;
    	}
        return false;
    }

    @Override
    public int hashCode() {
        return this.id.hashCode();
    }
}
